#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "MSTK.h"


#ifdef __cplusplus
extern "C" {
#endif

  /* This function adds ghost entities and assigns PUTILIZED entities
     note: no edge PType is assigned, edge PType can be constructed 

     ring: ghost cell size, right now, only 1-ring 

     must call PMESH_BuildPType() first
          
  */
int MESH_AddGhost(Mesh_ptr mesh, Mesh_ptr submesh, int ring) {
  int nf, nr;
  /* basic mesh information */
  nf = MESH_Num_Faces(submesh);
  nr = MESH_Num_Regions(submesh);

  if (nr)
    MESH_Vol_AddGhost(mesh,submesh,ring);
  else if(nf) 
    MESH_Surf_AddGhost(mesh,submesh,ring);
  else {
    fprintf(stdout,"\nThis is not a valid mstk file for partition\n");
    exit(-1);
  }
  return 1;
}
  
#ifdef __cplusplus
}
#endif

